<!--
 * Created by PhpStorm.
 * User: jackhhy
 * Date: 2019/7/19-11:11
 * Link: https://gitee.com/luckygyl/LuckyAdmin
 * FileName: addlink.html
 **************************************************************
 *                                                            *
 *   .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.       *
 *    |                     ______                     |      *
 *    |                  .-"      "-.                  |      *
 *    |                 /            \                 |      *
 *    |     _          |              |          _     |      *
 *    |    ( \         |,  .-.  .-.  ,|         / )    |      *
 *    |     > "=._     | )(__/  \__)( |     _.=" <     |      *
 *    |    (_/"=._"=._ |/     /\     \| _.="_.="\_)    |      *
 *    |           "=._"(_     ^^     _)"_.="           |      *
 *    |               "=\__|IIIIII|__/="               |      *
 *    |              _.="| \IIIIII/ |"=._              |      *
 *    |    _     _.="_.="\          /"=._"=._     _    |      *
 *    |   ( \_.="_.="     `--------`     "=._"=._/ )   |      *
 *    |    > _.="                            "=._ <    |      *
 *    |   (_/                                    \_)   |      *
 *    |                                                |      *
 *    '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='      *
 *                                                            *
 *                    JUST FIND YOUR BUG !                    *
 **************************************************************
 *-->


{include file="public/open_head" /}

<div class="ok-body">

    <div class="layui-fluid">
        <div class="layui-card">
            <!-- <div class="layui-card-header"></div>-->

            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form" action="" lay-filter="component-form-group">

                    <div class="layui-form-item">
                        <label class="layui-form-label">上级栏目：</label>
                        <div class="layui-input-block">

                            <select name="pid" lay-search="">
                                <option value="0" >顶级栏目</option>
                                {volist name="tree" id="t"}
                                <option value="{$t.id}">{$t.title_show}</option>
                                {/volist}
                            </select>

                        </div>
                    </div>

                    <input type="hidden" name="model_id" value="7" >

                    <?php echo Form::Input('text','title','','栏目名称','请输入名称','required');?>
                    {:token()}
                    <?php echo Form::Radio('fontFamily','layui-icon','图标类型',array('layui-icon'=>'layui图标','fa'=>'font-awsome图标'),'','radio');?>

                    <?php echo Form::Input('text','href','http://','链接地址','链接地址','','以http://开头');?>

                    <?php echo Form::Input('text','layui-icon','','选择图标','','','','','block','','layui-tubiao','iconFonts');?>

                    <?php echo Form::Input('text','fa','','选择图标','','','','','block','','font-tubiao','font-tubiao','display:none;');?>

                    <?php echo Form::Radio('status',1,'是否显示',array('1'=>'显示','2'=>'隐藏'),'','','inline');?>

                    <?php echo Form::Input('number','listorder','0','菜单排序','排序','','','','inline');?>

                    <!--
                    <div class="layui-form-item">
                        <?php echo Form::Radio('status',1,'是否显示',array('1'=>'显示','2'=>'隐藏'),'','','inline',2);?>
                        <?php echo Form::Input('number','listorder','0','菜单排序','排序','','','','inline',2);?>
                    </div>-->

                    <?php echo Form::Submit('add','立即提交');?>


                </form>
            </div>
        </div>
    </div>


</div>




<script>
    layui.config({
        base: "{__FRAME_PATH}js/"
    }).extend({
        IconFonts: 'iconFonts/iconFonts',
        iconPicker:'iconPicker/iconPicker'
    });

    layui.use(['element', 'form', 'jquery','IconFonts','iconPicker'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var IconFonts = layui.IconFonts;
        var iconPicker=layui.iconPicker;


        //图标选择器
        iconPicker.render({
            // 选择器，推荐使用input
            elem: '#iconFonts',
            // 数据类型：fontClass/layui_icon，
            type: 'fontClass',
            // 是否开启搜索：true/false
            search: true,
            // 是否开启分页
            page: true,
            // 每页显示数量，默认12
            limit: 12,
            // 点击回调
            click: function (data) {
                //console.log(data);
            }
        });

        IconFonts.render({
            // 选择器，推荐使用input
            elem: '#font-tubiao',
            // 数据类型：fontClass/layui_icon，
            type: 'fontClass',
            // 是否开启搜索：true/false
            search: true,
            // 是否开启分页
            page: true,
            // 每页显示数量，默认12
            limit: 12,
            // 点击回调
            click: function (data) {
                //console.log(data);
            }
        });

        /**
         *
         */
        form.on("radio(radio)",function (data) {
            //console.log(data);
            if (data.value=="fa"){
                $(".layui-tubiao").hide(0);
                $(".font-tubiao").show(0);
            } else {
                $(".layui-tubiao").show(0);
                $(".font-tubiao").hide(0);
            }
        });


        form.on('submit(add)', function (data) {
            FormSubmit("{:url('navigate/Addlink')}",data.field,"tableFilter",1);
            return false;
        });



    })
</script>


</body>
</html>
